package com.acxiom.bsh.exception;

import com.acxiom.bsh.logger.LoggerManager;

public class ExceptionBuilder {

	public static BshException buildException(String code, String message, Throwable clause) {
		BshException ae = new BshException(code, message, clause);
		logException(ae);
		return ae;
	}
	
	public static BshException buildException(String code, String message) {
		
		return buildException(code, message, null);
	}

	private static void logException(BshException e) {
		LoggerManager.getErrorLogger().error(e.getCode() + ", " + e.getMessage(),e);
	}


}
